export default function getBtoaBySvg(data) {
  //const URL = window.URL || window.webkitURL || window;
  const svg = new Blob([data], { type: "image/svg+xml" });
  //const src = URL.createObjectURL(svg);
  return new Promise((resolve, reject) => {
    const fileReader = new FileReader();
    fileReader.onloadend = () => {
      resolve(fileReader.result);
    };
    fileReader.onerror = () => {
      reject("Convert failed");
    };
    fileReader.readAsDataURL(svg);
  });
}

// const data = `<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
// <circle cx="100" cy="50" r="40" stroke="black"
// stroke-width="2" fill="red" />
// </svg>`;

// getBase64BySvgData(data).then((ret) => {
//   console.log(ret);
// });
